
x = [5,1,3,2,4]
y = (int[]) x

x.add 6
x << 7

println x.collect { it + 100 + "万円" }
println y.collect { it + 100 + "万円" }

println x.findAll { it < 3 }
println x.find { it < 3 }

println x.inject(1) { i,j -> i * j } // 配列の総積
println x.sort { x,y -> y <=> x }
println x.sort()

class Bean {
	def a
	def b
	def c
}

beanArray = [
new Bean(a:"1", b:"bbb", c:"ccdac"),
new Bean(a:"2", b:"dbbb", c:"cacc"),
new Bean(a:"3", b:"bbb", c:"cadcc"),
new Bean(a:"4", b:"bdbb", c:"ccfdc"),
new Bean(a:"5", b:"bdfbb", c:"csdcc"),
new Bean(a:"6", b:"basdbb", c:"csdfcc"),
new Bean(a:"7", b:"bfdbb", c:"csdcc"),
new Bean(a:"8", b:"badbb", c:"csdfcc")]

beanArray.sort();
beanArray.each {
	println it.a
}

beanArray2 = [
	new Bean(a:"1", b:"bbb", c:"ccdac"),
	new Bean(a:"2", b:"dbbb", c:"cacc"),
	new Bean(a:"3", b:"bbb", c:"cadcc"),
	new Bean(a:"4", b:"bdbb", c:"ccfdc"),
	new Bean(a:"4", b:"bdfbb", c:"csdcc"),
	new Bean(a:"5", b:"basdbb", c:"csdfcc"),
	new Bean(a:"6", b:"bfdbb", c:"csdcc"),
	new Bean(a:"7", b:"badbb", c:"csdfcc")]

beanArray2.sort { [it.c, it.b]}
beanArray2.each {
	println it.c + it.b
}

joinList = [1,2,3].join(",")
println joinList

println beanArray2.every {
	it.b =~/b+/
}

println beanArray2.any {
	it.b ==~/bbb/
}


